package com.houzehui.product.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * Description :
 *
 * @author yll
 * @date 2021-09-25 21:47
 */
//扫描mapper文件夹
@MapperScan("com.houzehui.product.mapper")
@EnableTransactionManagement
@Configuration //配置类
public class MyBatisConfig {
    
    // 分页插件
//    @Bean
//    public PaginationInterceptor paginationInterceptor() {
//        return  new PaginationInterceptor();
//    }
    //分页拦截
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return mybatisPlusInterceptor;
    }
    
}
